<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>全部新闻</title>
</head>
<body>

<div align="center">
    <form action="/detail/list" method="post">

        <select name="categoryId">
            <option value="">---请选择---</option>
            <c:forEach items="${categoryList}" var="cat">
                <option value="${cat.id}" <c:if test="${newsDetail.categoryId==cat.id}">selected</c:if>>${cat.name}</option>
            </c:forEach>
        </select>
        <input type="text" name="title" id="title" value="${newsDetail.title}"/>
        <input type="submit" value="查询"/>
    </form>
</div>


<table align="center" border="1px soild"  width="800px" style=" border-collapse:collapse;">
    <tr>
        <td colspan="6" align="center"><h1>新闻标题</h1></td>
    </tr>
    <tr style="background-color: antiquewhite">
        <td width="80px"><h4>新闻编号</h4></td>
        <td><h4>新闻标题</h4></td>
        <td><h4>新闻摘要</h4></td>
        <td width="100px"><h4>作者</h4></td>
        <td width="150px"><h4>创建时间</h4></td>
        <td width="50px"><h4>操作</h4></td>
    </tr>
    <c:forEach items="${detailList}" var="detail" varStatus="count">
    <tr  <c:if test="${count.count%2!=0}">style="background-color: silver"</c:if> >
        <td>${detail.id}</td>
        <td>${detail.title}</td>
        <td>${detail.summary}</td>
        <td>${detail.author}</td>
        <td>
            <f:formatDate value="${detail.createDate}" pattern="yyyy-MM-dd HH:mm"/>
        </td>
        <td><a href="/detail/toUpdate?id=${detail.id}">修改</a></td>
    </tr>
    </c:forEach>

</table>



</body>
</html>
